package com.songdian.service.impl;

import com.songdian.service.MessageService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceImpl implements MessageService {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @Override
    public void sendMessage(String id) {

        System.out.println("订单已加入队列===============" + id);
        //amqpTemplate.convertAndSend("direct_exchange","direct",id);
        amqpTemplate.convertAndSend("topic_exchange","topic.order.id",id);

    }
}
